package com.foreknow.service.impl;

import com.foreknow.dao.impl.AdminDaoImpl;
import com.foreknow.db.DBManager;
import com.foreknow.model.Admin;
import com.foreknow.service.AdminService;

import java.sql.Connection;
import java.sql.SQLException;

public class AdminDaoServiceImpl implements AdminService {
    @Override
    public Admin isValidate(String username, String password) {
        //获取DBManager的对象
        DBManager db = DBManager.getInstance();
        //拿到数据库连接
        Connection conn = db.getConnection();
        //new AdminDaoImpl这个类对象
        AdminDaoImpl service = new AdminDaoImpl();
        //因为AdminDaoImlp继承了BaseDao,所以可以直接调用里面连接数据库的方法
        service.setConnection(conn);
        Admin login=null;
        try {
             login = service.isCheckLogin(username, password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return login;
    }
}
